import _ajax from '@/utils/http.js'

// 取消关注用户
function unfollow (id) {
  return _ajax({
    url: `/app/v1_0/user/followings/${id}`,
    method: 'DELETE',
    needToken: true
  })
}

// 关注用户
function follow (data) {
  return _ajax({
    url: '/app/v1_0/user/followings',
    method: 'POST',
    data,
    needToken: true
  })
}
// 取消拉黑用户
function cancelBlackLists (id) {
  return _ajax({
    url: `/app/v1_0/user/blacklists/${id}`,
    method: 'DELETE',
    needToken: true
  })
}

//  拉黑用户
function goBlackLists (data) {
  return _ajax({
    url: '/app/v1_0/user/blacklists',
    method: 'POST',
    data,
    needToken: true
  })
}

// 获取指定用户信息
function getUserProfile (id, params) {
  return _ajax({
    url: `/app/v1_0/users/${id}`,
    method: 'GET',
    params,
    needToken: true
  })
}

// 获取用户关注列表
function getUserFollowings (params) {
  return _ajax({
    url: '/app/v1_0/user/followings',
    method: 'GET',
    params,
    needToken: true
  })
}

// 获取用户的粉丝列表
function getUserFollowers (params) {
  return _ajax({
    url: '/app/v1_0/user/figure',
    method: 'GET',
    params,
    needToken: true
  })
}
// 获取用户统计数据
function getUserFigure (params) {
  return _ajax({
    url: '/app/v1_0/user/figure',
    method: 'GET',
    params,
    needToken: true
  })
}
// 获取用户自己信息
function getUserInfo (params) {
  return _ajax({
    url: '/app/v1_0/user',
    method: 'GET',
    params,
    needToken: true
  })
}
export {
  unfollow,
  follow,
  cancelBlackLists,
  goBlackLists,
  getUserProfile,
  getUserFollowings,
  getUserFollowers,
  getUserFigure,
  getUserInfo
}
